package com.hnas.ecard.mapper;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.hnas.core.mapper.Mapper;
import com.hnas.ecard.orm.Merchant;
import com.hnas.ecard.service.dto.DTOMerchant;

public class MerchantMapper extends Mapper<DTOMerchant,Merchant>{

    private static MerchantMapper mapper;

	
	private MerchantMapper(){
		super(DTOMerchant.class,Merchant.class);
	}
	
	public static MerchantMapper getInstance(){
		if(mapper == null){
			mapper = new MerchantMapper();
		}
		return mapper;
	}
	
	public DTOMerchant mapToValue(Merchant vo){
		DTOMerchant dto = new DTOMerchant();
		BeanUtils.copyProperties(vo, dto);
		return dto;
	}
	
	public List<DTOMerchant> mapToValue(List<Merchant> list){
		List<DTOMerchant> dtoList = new ArrayList<DTOMerchant>();
		for(Merchant vo : list){
			DTOMerchant dto = mapToValue(vo);
			dtoList.add(dto);
		}
		return dtoList;
	}
}
